package com.ibm.law.ui;

import org.eclipse.jface.action.Action;

import com.ibm.law.domain.Resource;

public class ActionFactory {

	public static Action getAction(final Resource resource) {
		Action action=null;
		System.out.println(resource.getId()+"/"+resource.getService());
		try {
			action = (Action)Class.forName(resource.getService()).newInstance();
			action.setText(resource.getName());
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		
		return action;
		/*
		Action action = new Action() {
			@Override
			public void run() {
				System.out.println(resource.getService());
				String service=resource.getService();
				Class.forName(arg0)
				SystemSetupDialog dialog = new SystemSetupDialog(AppWindow
						.getInstance().getShell(), SWT.DIALOG_TRIM
						| SWT.APPLICATION_MODAL);
				dialog.open();
			}
		};
		action.setText(resource.getName());
		
		return action;*/
	}
}
